package mvc.util;

import java.lang.reflect.Field;

import javax.servlet.http.HttpServletRequest;

import mvc.form.ActionForm;

public class FullBean {
	public FullBean() {

	}

	public static ActionForm full(HttpServletRequest request) {
		ActionForm form = null;
		try {
			Class clazz = Class.forName(request.getParameter("sign"));
			form = (ActionForm) clazz.newInstance();
			Field[] fieldArr = clazz.getDeclaredFields();
			for (Field f : fieldArr) {
				f.setAccessible(true);
				f.set(form, request.getParameter(f.getName()));
				f.setAccessible(false);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return form;
	}
}
